﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Net.Sockets;

namespace SharpWebSocket
{
    public delegate void WebSocketConnected( object sender, WebSocketConnectedEventArgs e );

    public delegate void DataReceived(object sender, DataReceivedEventArgs e );

    public delegate void SocketClosed( object sender, SocketClosedEventArgs e );

    public delegate void Init( object sender, EventArgs e );

    public class WebSocketConnectedEventArgs : EventArgs
    {
        public WebSocketConnectedEventArgs(Socket socket, Uri url)
        {

        }

        public Socket Socket
        {
            get;
            protected set;
        }

        public string Protocol
        {
            get
            {
                return "Draft10";
            }
        }

        public Uri Url
        {
            get;
            protected set;
        }
    }

    public class DataReceivedEventArgs : EventArgs
    {
        public DataReceivedEventArgs( /*Socket clientSocket, */string receivedString )
        {
            ReceivedString = receivedString;
            //ClientSocket = clientSocket;
        }

        /*public byte[] ByteData
        {
            get;
            protected set;
        }*/

        public string ReceivedString
        {
            get;
            protected set;
        }

        //public Socket ClientSocket
        //{
        //    get;
        //    protected set;
        //}
    }

    public class SocketClosedEventArgs : EventArgs
    {
        public SocketClosedEventArgs( Socket socketClient, SocketError socketError = System.Net.Sockets.SocketError.Success )
        {
            SocketClient = socketClient;
            SocketError = socketError;
        }

        public Socket SocketClient
        {
            get;
            protected set;
        }

        public SocketError SocketError
        {
            get;
            protected set;
        }
    }
}
